#include "GY_GraphicsEditItem.h"
#include <QDebug>
#include <QBrush>
#include <QCursor>
GY_GraphicsEditItem::GY_GraphicsEditItem(QGraphicsItem *parent) : QGraphicsRectItem(parent)
{
    setCursor(QCursor(Qt::CrossCursor));
    setAcceptHoverEvents(true);
    setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsFocusable);
    setBrush(QBrush(QColor(Qt::red),Qt::SolidPattern));
}

void GY_GraphicsEditItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
    m_pressPoint = event->pos();
}

void GY_GraphicsEditItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
//    this->moveBy(event->pos().rx()-m_pressPoint.rx(),event->pos().ry()-m_pressPoint.ry());
    emit editPointFChange(this , this->data(GY_ENUM::ObjectName).toString(),event->scenePos());
}
